<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<button onclick="numbers.forEach(myFunction)">点我</button>
<p id="demo"></p>

<ul id="seckillSkuContent">

</ul>

</body>

<script>
    demoP = document.getElementById("demo");
    var numbers = [4, 9, 16, 25];

    function myFunction(item, index) {
        demoP.innerHTML = demoP.innerHTML + "index[" + index + "]: " + item + "<br>";

    }


        console.log(1111);
        $.getJSON('/index/item.json', function (res) {
            if (res.data.length > 0) {
                //console.log("res.data的值"+JSON.toJSONString(res.data));


                res.data.forEach(function (item) {
                        console.log($(item.skuId));
                        console.log("我的产品:" + $(item));
                        $("<li onclick='toDetail(" + item.skuId + ")'></li>")
                            .append($("<img style='width: 130px; height: 130px' src='" + item.skuInfo.skuDefaultImg + "' />"))
                            .append($("<p>" + item.skuInfo.skuTitle + "</p>"))
                            .append($("<span>" + item.seckillPrice + "</span>"))
                            .append($("<s>" + item.skuInfo.price + "</s>"))
                            .appendTo("#seckillSkuContent");
                    }
                )
            }

        })
        console.log($("#seckillSkuContent").innerHTML);

</script>
<script type="text/javascript" src="/index/item.json"></script>
</html>